const express = require('express');
const { currentUser } = require('../configs/auth');
const router = express.Router();

const auth = require('../utils/auth')

router.get('/', () => {
	res.send('api')
});

router.post('/account/register', require('../controllers/account').register)

router.post('/account/login', require('../controllers/account').login)

router.get('/account/profile', auth, async (req, res) => {
	console.log(req[currentUser]);
	res.send('profile12')
})

router.get('/article/:id', require('../controllers/article').getArticle)
router.post('/article', require('../controllers/article').postArticle)
router.delete('/article/:id', require('../controllers/article').deleteArticle)
router.patch('/article/:id', require('../controllers/article').updateArticle)

module.exports = { router }
